from .web_element import WebElement


class SpanTag(WebElement):
    '''
    span元素操作
    '''

    def get_title(self):
        '''
        获取元素的title属性值

        :Returns:
            返回元素的title属性值
        '''
        return self.control.GetTitle

    def set_title(self, title):
        '''
        设置元素的title属性值

        :Args:
         - title: 元素的title属性值
        '''
        self.control.SetTitle(title)

    def get_attribute(self, name):
        '''
        获取属性值

        :Args:
         - name: 属性名称

        :Returns:
            返回属性值
        '''
        if name == 'class':
            return self.get_css_class()
        elif name == 'id':
            return self.get_id()
        elif name == 'title':
            return self.get_title()
        else:
            return self.get_attribute_value(name)